<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .active {
            color: red;
        }

        p {
            display: none;
        }
    </style>
</head>

<body>

    <div class="tab">
        <div class="hd">
            <button class="active">1</button>
            <button>2</button>
            <button>3</button>
        </div>
        <div class="bd">
            <p style="display:block">1</p>
            <p>2</p>
            <p>3</p>
        </div>
    </div>


    <script src="../js/jq.js"></script>

    <script>

        $('button').on('click', function () {
            // $(this).addClass('active').siblings().removeClass('active');
            // $('p').hide().eq($(this).index()).show();

            $(this).addClass('active').siblings().removeClass('active').parent().next().find('p').hide().eq($(this).index()).show();
        })


    </script>

</body>

</html>